Skip to content

fix(model-downloader): subscribe to progress via the ComfyUI API client - #120

Merged
jamesbrink merged 1 commit into
mainfrom
fix/downloader-api-listener
Nov 12, 2026
Merged

jamesbrink merged 1 commit into
mainfrom
fix/downloader-api-listener

Conversation

@jamesbrink

Copy link
Copy Markdown
Member

Follow-up from #119.

Problem

model_downloader.js registered its model_download_progress listener only through window.api, which no current frontend defines (they expose window.comfyAPI.api.api). Those registrations were no-ops, so:

  • Progress arrived only through the WebSocket onmessage monkey-patch fallback.
  • Frontend 1.57 logs console.error("Unknown message type model_download_progress") for any message type without a listener. 1.52 logged the same thing as a warning.

Fix

  • Resolve the API client as window.comfyAPI?.api?.api || window.app?.api || window.api and call addEventListener('model_download_progress', …) on it.
  • The core's handleMessageEvent already unwraps CustomEvent.detail.
  • The WebSocket patch is kept only as a fallback when no API client is found.
  • The dead registerExtension, registerMessageHandler and reportedUnknownMessageTypes paths are removed.

Testing

Headless Chromium (Playwright) against nix run .#default on ./data with ComfyUI 0.44.0 and frontend 1.57.6:

  • Unknown message type model_download_progress no longer appears in the console.
  • The "Successfully patched WebSocket handler" log is gone, so the listener path is the one in use.
  • A detached <a download> click was intercepted, and the backend download completed at 100%. Two progress events reached handleMessageEvent.
  • The only remaining console errors are the Impact-Pack clipspace.js 404s, which already existed before this change.

@jamesbrink
jamesbrink merged commit 935b59f into main Nov 12, 2026
25 of 26 checks passed
@jamesbrink
jamesbrink deleted the fix/downloader-api-listener branch November 12, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant